#include <iostream>
#include<stdio.h>

int main() {
    int arr[4] = {1, 2, 3};
    int num, number, len;
    scanf("%d\n%d", &num, &number);
    for (int i = 2; i >= 1; i--) {
        arr[i + 1] = arr[i];
    }
    arr[1] = num;
    for (int i : arr) {
        printf("  %d", i);
    }
    len = 4;
    printf("\n");
    if (number == 4) {
        len--;
        for (int i = 0; i < len; i++) {
            printf("  %d", arr[i]);
        }
    }else {
        for (int i = 0; i < len; i++) {
            if (i == number - 1) {
                for (int j = i; j <= 3; j++) {
                    arr[j] = arr[j + 1];
                }
                len--;
            }
        }if (number > len) {
            printf("false");
        } else {
            for (int i = 0; i < len; i++) {
                printf("  %d", arr[i]);
            }
        }
    }
    return 0;
}
